package com.Util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @description: properutils工具类
 * @author: hkw14
 * @time: 2021/4/28 15:32
 */
public class PropertiesUtil {
    public static String getValue(String propFile,String key){
        InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream(propFile);
        Properties properties = new Properties();
        if (inputStream == null){
            throw new RuntimeException(propFile + "文件没有找到");
        }
        try {
            properties.load(inputStream);
            return properties.getProperty(key);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
